Skip to content

media/hevc_d: Improve checking and cleanup of decoder - #7583

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_dec_valid_3
Sep 2, 2026
Merged

media/hevc_d: Improve checking and cleanup of decoder#7583
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_dec_valid_3

Conversation

@jc-kynesim

Copy link
Copy Markdown
Contributor

A number of fixes and cleanup - many Claude inspired.

Optimise guessing of new PU/Coeff buffers is we have already had to reallocate in this context.

Fix buffer size roundup code so it rounds up as intended rather than to twice that amount.

Reset slot tracking on streamoff so it doesn't become fatally confused if a second run is started before closing the context.

Fix accounting for size of scaling factor list when alloocating command buffers. Previously would over allocate a bit.

A number of fixes to decoder cleanup on release or probe error where structures could be leaked or were freed in the wrong order.

Fix typo and pointless && clause in Kconfig

Collocated ref index was bounds checked against the wrong value, potentially ending up with feeding random addresses to the h/w.

Many more slice header and PPS parameters checked that could potentially misprogram the hardware.

Generaly tidy and remove dead code and structures.

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two very minor nits as I know they'd get flagged upstream.

Comment thread drivers/media/platform/raspberrypi/hevc_dec/hevc_d.c
Comment thread drivers/media/platform/raspberrypi/hevc_dec/hevc_d.c
A number of fixes and cleanup - many Claude inspired.

Optimise guessing of new PU/Coeff buffers is we have already had to
reallocate in this context.

Fix buffer size roundup code so it rounds up as intended rather
than to twice that amount.

Reset slot tracking on streamoff so it doesn't become fatally confused
if a second run is started before closing the context.

Fix accounting for size of scaling factor list when alloocating command
buffers. Previously would over allocate a bit.

A number of fixes to decoder cleanup on release or probe error where
structures could be leaked or were freed in the wrong order.

Fix typo and pointless && clause in Kconfig

Collocated ref index was bounds checked against the wrong value,
potentially ending up with feeding random addresses to the h/w.

Many more slice header and PPS parameters checked that could potentially
misprogram the hardware.

Generaly tidy and remove dead code and structures.

Signed-off-by: John Cox <jc@kynesim.co.uk>
@jc-kynesim
jc-kynesim force-pushed the dev/6.18/hevc_dec_valid_3 branch from 5fb97cb to ad2f32c Compare September 1, 2026 15:38

@popcornmix popcornmix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been running this at home for a number of days without issue.

@pelwell
pelwell merged commit f2bc178 into raspberrypi:rpi-6.18.y Sep 2, 2026
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Sep 4, 2026
kernel: staging: vc04_services: fix pointer arithmetic in create_pagelist
See: raspberrypi/linux#7593

kernel: rp1-pio+dw-axi-dmac: add cyclic DMA support, ability to select light vs heavy DMA
See: raspberrypi/linux#7598

kernel: overlays: ed-backlight-pwm: Add EDATEC PWM backlight overlay
See: raspberrypi/linux#7597

kernel: configs: Add CAN_VXCAN=m
See: raspberrypi/linux#7592

kernel: media/hevc_d: Improve checking and cleanup of decoder
See: raspberrypi/linux#7583

kernel: drm/vc4: hdmi: Don't write past the end of a packet RAM slot
See: raspberrypi/linux#7579

kernel: bcm2835-i2s: fail capture open cleanly when FIFO clear has no clock
See: raspberrypi/linux#7586

kernel: vc04_services: bounds and fd handling fixes
See: raspberrypi/linux#7576

kernel: overlays: wm8960-soundcard: Add media parameter
See: raspberrypi/linux#7577

kernel: overlays: rt5616: Add RT5616 audio codec overlay
See: raspberrypi/linux#7574

kernel: arm64: defconfig: Enable RT5616 codec in Pi configurations
See: raspberrypi/linux#7575
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Sep 4, 2026
kernel: staging: vc04_services: fix pointer arithmetic in create_pagelist
See: raspberrypi/linux#7593

kernel: rp1-pio+dw-axi-dmac: add cyclic DMA support, ability to select light vs heavy DMA
See: raspberrypi/linux#7598

kernel: overlays: ed-backlight-pwm: Add EDATEC PWM backlight overlay
See: raspberrypi/linux#7597

kernel: configs: Add CAN_VXCAN=m
See: raspberrypi/linux#7592

kernel: media/hevc_d: Improve checking and cleanup of decoder
See: raspberrypi/linux#7583

kernel: drm/vc4: hdmi: Don't write past the end of a packet RAM slot
See: raspberrypi/linux#7579

kernel: bcm2835-i2s: fail capture open cleanly when FIFO clear has no clock
See: raspberrypi/linux#7586

kernel: vc04_services: bounds and fd handling fixes
See: raspberrypi/linux#7576

kernel: overlays: wm8960-soundcard: Add media parameter
See: raspberrypi/linux#7577

kernel: overlays: rt5616: Add RT5616 audio codec overlay
See: raspberrypi/linux#7574

kernel: arm64: defconfig: Enable RT5616 codec in Pi configurations
See: raspberrypi/linux#7575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants